<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/jsp/commons/taglibs.jsp" %>
<!DOCTYPE HTML>
<html ng-app>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <META HTTP-EQUIV="pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
    <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
    <title>${title}</title>
    <%@ include file="/WEB-INF/jsp/commons/meta.jsp" %>
    <link href="${ctx}/resources/new/style.css" type="text/css" rel="stylesheet"/>

</head>
<body>
<!-- 分页显示演示开始 -->
<style>
    <!--
    .tab {
        margin-bottom: 0px;
        margin-top: 6px;
    }

    .tab > li > a {
        line-height: 22px;
        padding-bottom: 2px;
        padding-top: 2px;
    }

    .tab-content {
        border: 1px solid #E3E3E3;
        border-radius: 0px 0px 4px 4px;
        border-top: none;
        padding: 2px;
    }

    .table [valign="top"] {
        vertical-align: top;
    }

    tr td:FIRST-CHILD {
        text-align: right;
    }

    input[readonly] {
        cursor: auto;
    }

    -->
</style>
<ul class="nav nav-tabs tab tBlock">
    <li class="active">
        <a deny="not" class="nFocus" href="#step" data-toggle="tab">
            <i class="icon-tags"></i>
            修改密码
        </a>
    </li>
</ul>
<div class="tab-content">
    <div class="tab-pane active">
        <form id="inputForm" class="form-inline" action="${ctx}/security/users/passwd2" method="post">
            <table style="width: 80%; margin: auto;" class="table table-striped table-bordered table-condensed">
                <tr>
                    <td width="30%">原始密码：</td>
                    <td>
                        <input type="password" name="oldpwd" id="oldpwd"/>
                        <input type="hidden" name="uid" value="${USER.id }"/>
                    </td>
                </tr>
                <tr>
                    <td>新密码：</td>
                    <td>
                        <input type="password" name="newpwd" id="newpwd"/>
                    </td>
                </tr>
                <tr>
                    <td>确认密码：</td>
                    <td>
                        <input type="password" name="passwd"/>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <button type="submit" class="btn btn-primary">提 交</button>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</div>
<script type="text/javascript">
    $("#inputForm").validate({
        rules: {
            oldpwd: {
                required: true,
                remote: {
                    type: "POST",
                    url: "${ctx}/security/users/isOldpwd",
                    data: {
                        oldpwd: function () {
                            return $("#oldpwd").val();
                        },
                        uid: "${USER.id}"
                    }
                }
            },
            newpwd: {
                required: true,
                minlength: 6
            },
            passwd: {
                required: true,
                equalTo: "#newpwd"
            }
        },
        messages: {
            oldpwd: {
                remote: $.format("原始密码不正确！")
            }
        }
    });
    <c:if test="${msg != null}">
        $(function () {
            msgAlert.show("${msg}");
        });
    </c:if>
</script>
</body>
</html>